package cn.rongdao.jrkabao.model.main;

import android.text.TextUtils;

import com.mifengkong.frtools.http.request.HttpFunction;

import cn.rongdao.jrkabao.bean.main.MainBean;
import cn.rongdao.jrkabao.dao.CityDao;
import cn.rongdao.jrkabao.model.api.BaseSuDaiModel;
import io.reactivex.Observable;
import io.reactivex.Observer;

/**
 * Created by jack on 17/5/15
 */

public class MainModel extends BaseSuDaiModel {

    public static MainModel getInstance() {
        return getPresent(MainModel.class);
    }

    public void execute(Observer<MainBean> observer) {
        addParamStrings("haveCreditCard", 1);
        addParamStrings("city_id", TextUtils.isEmpty(CityDao.getInstance().getCityId()) ? "21" : CityDao.getInstance().getCityId());
        Observable<MainBean> observable = mServletApi.getMainInfo(mParams).map(new HttpFunction<MainBean>());
        toSubscribe(observable, observer);
    }
}
